Crate near_token

source ·
Expand description

A NearToken type to represent a value of Near.

Each Neartokens is composed of a floating point number of tokens where each integer unit is equal to one yocto-Near. NearToken is implementing the common trait FromStr. Also, have utils function to parse from str into u128.

Examples

use near_token::NearToken;

let one_near = NearToken::from_yoctonear(10_u128.pow(24));
assert_eq!(one_near, NearToken::from_near(1));
assert_eq!(one_near, NearToken::from_millinear(1000));

Crate features

  • borsh (optional) - When enabled allows NearToken to serialized and deserialized by borsh.

  • serde (optional) - When enabled allows NearToken to serialized and deserialized by serde.

  • schemars (optional) - Implements schemars::JsonSchema for NearToken.

  • interactive-clap (optional) - Implements interactive_clap::ToCli for NearToken.

Structs

Enums